package com.leonse.order.service.impl;

import com.leonse.order.feign.MyFeignClient;
import com.leonse.order.mapper.OrderMapper;
import com.leonse.order.service.OrderService;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author leonse
 * @date 2023/12/28 22:50
 **/
@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private MyFeignClient feignClient;

    @Autowired
    private OrderMapper mapper;


    @GlobalTransactional
    @Override
    public Integer createOrder(Integer productId) {
        feignClient.deduction();
        int i = 1 / 0;
        return mapper.createOrder(productId);
    }
}
